<?php session_start() ?>
<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>联系人管理 － 登录</title>
        <link href="https://cdn.bootcss.com/bootswatch/4.3.1/darkly/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" href="css/font-awesome.min.css">
        <style>
        .container {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .card {
            max-width: 60%;
        }

        .footer {
            padding-top: 20px;
        }

        .footer a {
            text-decoration: none;
            color: #fff;
            display: inline-block;
            margin-left: 30px;
            border-radius: 5px;
            padding: 5px;
        }

        .footer a:hover {
            background-color: #fff;
            color: #000;
        }
        </style>
    </head>

    <body>
        <div class="container">

            <div class="card">
                <div class="card-header">
                    用户登陆
                </div>
                <div class="card-body">
                    <form action="do-login.php" method="post">
                        <table style="border-collapse: separate;border-spacing: 0px 10px;">
                            <?php if(isset($_SESSION["LOGIN_ERROR"])) {?>
                            <tr>
                                <td colspan="2" style="color:#FA9D89;"><?php echo $_SESSION["LOGIN_ERROR"] ?></td>
                            </tr>
                            <?php } ?>
                            <tr>
                                <td style="margin-top:10">
                                    <label>用户名 *：</label>
                                </td>
                                <td>
                                    <input type="text" name="username"
                                        value="<?php  echo isset($_COOKIE['username'])? $_COOKIE['username'] : "" ?>"
                                        class="">
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <label for="password">密码 *:</label>
                                </td>
                                <td>
                                    <input id="password" type="password" name="password"
                                        value="<?php  echo isset($_COOKIE['password'])? $_COOKIE['password'] : "" ?>">
                                </td>
                            </tr>
                        </table>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input type="checkbox" name="remeber_me" class="form-check-input"
                                    <?php if(isset($_COOKIE['username'])) { ?> checked <?php } ?>>记住密码
                            </label>
                        </div>
                        <div class="footer">
                            <button type="submit" class="btn btn-primary">登录</button>
                            <!-- <button type="" class="btn btn-secondary" οnclick="Toregister()">注册</button> -->
                            <a href="#">忘记密码？</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
        <script src="https://cdn.bootcss.com/popper.js/1.15.0/umd/popper.min.js"></script>
        <script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    </body>

</html>